package jp.eisbahn.mgapi.http;

import java.util.List;
import java.util.Map;

/**
 * This class represent the response of a HTTP communication.
 * @author Yoichiro Tanaka
 */
public class BasicHttpResponse implements HttpResponse {

    /** The status code. */
    private int responseCode;
    /** The status message. */
    private String responseMessage;
    /** The response body. */
    private String responseBody;
    /** The response header map. */
    private Map<String, List<String>> headerMap;

    /**
     * Initialize this instance.
     * @param newResponseCode The status code.
     * @param newResponseMessage The status message.
     * @param newResponseBody The response body.
     * @param newHeaderMap The response header values.
     */
    public BasicHttpResponse(
            final int newResponseCode,
            final String newResponseMessage,
            final String newResponseBody,
            final Map<String, List<String>> newHeaderMap) {
        super();
        responseCode = newResponseCode;
        responseMessage = newResponseMessage;
        responseBody = newResponseBody;
        headerMap = newHeaderMap;
    }

    /*
     * (non-Javadoc)
     * @see jp.eisbahn.mgapi.http.HttpResponse#getResponseCode()
     */
    @Override
    public final int getResponseCode() {
        return responseCode;
    }

    /*
     * (non-Javadoc)
     * @see jp.eisbahn.mgapi.http.HttpResponse#getResponseMessage()
     */
    @Override
    public final String getResponseMessage() {
        return responseMessage;
    }

    /*
     * (non-Javadoc)
     * @see jp.eisbahn.mgapi.http.HttpResponse#getResponseBody()
     */
    @Override
    public final String getResponseBody() {
        return responseBody;
    }

    /*
     * (non-Javadoc)
     * @see jp.eisbahn.mgapi.http.HttpResponse#getHeaderMap()
     */
    @Override
    public final Map<String, List<String>> getHeaderMap() {
        return headerMap;
    }

    /*
     * (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    @Override
    public final String toString() {
        return "HttpResponse [responseCode=" + responseCode
                + ", responseMessage=" + responseMessage + ", responseBody="
                + responseBody + ", headerMap=" + headerMap + "]";
    }

}
